// /////////////////////////////////////////////////////////////////////////////
//
// Name:            asBillboardComponent.h
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Binds the BillboardComponent class to AngelScript
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

#ifndef __ASBILLBOARDCOMPONENT_H__
#define __ASBILLBOARDCOMPONENT_H__

// Include files
#include "../../../dependencies.h"

#ifdef __COMPILE_WITH_ANGELSCRIPT__

#include "asSceneComponent.h"
#include "../../../components/scene/BillboardComponent.h"


//! Binds the BillboardComponent class to AngelScript.
extern void bindBillboardComponent(asIScriptEngine *engine);

//! Binds the base behaviours and methods of the BillboardComponent to the given class in
//! AngelScript.
template<typename T>
void bindBillboardComponentBase(asIScriptEngine *engine, const char *type)
{
    // Forward declaration.
    int r;
    std::string sType = type;

    // Bind inherited functions.
    bindSceneComponentBase<T>(engine, type);

    // Set common behaviour.
    r = engine->RegisterObjectBehaviour("BillboardComponent", asBEHAVE_REF_CAST, std::string(sType + "@ f()").c_str(),
                                        asFUNCTION((asRefCast<BillboardComponent,T>)), asCALL_CDECL_OBJLAST); assert( r >= 0 );
    r = engine->RegisterObjectBehaviour(type, asBEHAVE_IMPLICIT_REF_CAST, std::string("BillboardComponent@ f()").c_str(),
                                        asFUNCTION((asRefCast<T,BillboardComponent>)), asCALL_CDECL_OBJLAST); assert( r >= 0 );

    // Bind common class functions.
    r = engine->RegisterObjectMethod(type, "void getColor(SColor &out, SColor &out)",
                                     asMETHOD(T, getColor), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod(type, "const dimension2df& getSize()",
                                     asMETHOD(T, getSize), asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod(type, "void setColor(const SColor &in)",
                                     asMETHODPR(T, setColor, (const SColor&), void), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod(type, "void setColor(const SColor &in, const SColor &in)",
                                     asMETHODPR(T, setColor, (const SColor&, const SColor&), void), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod(type, "void setSize(const dimension2df &in)",
                                     asMETHOD(T, setSize), asCALL_THISCALL); assert(r >= 0);
}

#endif //__COMPILE_WITH_ANGELSCRIPT__

#endif
